<?php
/**
 * Created by PhpStorm.
 * User: 夏浩文
 * Date: 2017/6/14
 * Time: 15:01
 */
namespace app\hongyanche\controller;

class Coupon
{
    private $auth;
    public function __construct()
    {
        model('product')->demand('coupon_record');
        if (!model('admin')->is('coupon', 1)['state']) {
            $res = array('state' => 0, 'errormsg' => 'authority incorrect', 'errorcode' => '');
            $this->auth = $res;
        }else{
            $this->auth = array('state'=>1);
        }
    }

    //获取优惠券列表
    public function getlist()
    {
        
    }
    
    //兑换优惠券
    public function getCoupon()
    {
        $data['coupon_id'] = input('coupon_id');
        $data['amount'] = input('amount');
        $res = model('coupon')->getCoupon($data);
        return json($res);
    }


}
